#!/bin/bash

echo "备份开始时间："
date "+%F %T"
echo

# chmod 777 ./git_backup.sh

# cd /Users/frontop/Coding/smcp
# git clone https://e.coding.net/fronteam/smcp-boot/smcp-boot.git
# git clone https://e.coding.net/fronteam/smcp-boot/server-eureka.git
# git clone https://e.coding.net/fronteam/smcp-boot/server-config.git
# git clone https://e.coding.net/fronteam/smcp-boot/server-gateway.git
# git clone https://e.coding.net/fronteam/smcp-boot/smcp-core.git
# git clone https://e.coding.net/fronteam/smcp-boot/smcp-oauth.git
# git clone https://e.coding.net/fronteam/smcp-boot/smcp-oss.git
# git clone https://e.coding.net/fronteam/smcp-boot/smcp-exhibit.git
# git clone https://e.coding.net/fronteam/smcp-boot/smcp-ticket.git
# git clone https://e.coding.net/fronteam/smcp-boot/smcp-sls.git
# git clone https://e.coding.net/fronteam/smcp-boot/smcp-external.git
# git clone https://e.coding.net/fronteam/smcp-boot/smcp-cms.git
# git clone https://e.coding.net/fronteam/smcp-boot/smcp-public.git

# cd /Users/frontop/Coding/smcp-front
# git clone https://e.coding.net/fronteam/smcp-front/smcp-platform-front.git
# git clone https://e.coding.net/fronteam/smcp-front/smcp-tenant-front.git
# git clone https://e.coding.net/fronteam/smcp-front/miniprogram-guide.git

# cd /Users/frontop/Coding/smcp-app
# git clone https://e.coding.net/fronteam/smcp-app/iBeaconSet.git

# cd /Users/frontop/Coding/nh
# git clone https://e.coding.net/fronteam/nh/nhcms.git
# git clone https://e.coding.net/fronteam/nh/nhweb.git

# cd /Users/frontop/Coding/hengjian
# git clone https://e.coding.net/fronteam/hengjian/hengjian-websocket.git
# git clone https://e.coding.net/fronteam/hengjian/hengjian-front-send.git
# git clone https://e.coding.net/fronteam/hengjian/hengjian-front-receive.git

gitarr=(
    '101 smcp-boot /Users/frontop/Coding/smcp/smcp-boot'
    '102 smcp-core /Users/frontop/Coding/smcp/smcp-core'
    '103 server-eureka /Users/frontop/Coding/smcp/server-eureka'
    '104 server-config /Users/frontop/Coding/smcp/server-config'
    '105 server-gateway /Users/frontop/Coding/smcp/server-gateway'
    '106 smcp-oauth /Users/frontop/Coding/smcp/smcp-oauth'
    '107 smcp-oss /Users/frontop/Coding/smcp/smcp-oss'
    '108 smcp-sls /Users/frontop/Coding/smcp/smcp-sls'
    '109 smcp-external /Users/frontop/Coding/smcp/smcp-external'
    '110 smcp-exhibit /Users/frontop/Coding/smcp/smcp-exhibit'
    '111 smcp-ticket /Users/frontop/Coding/smcp/smcp-ticket'
    '112 smcp-cms /Users/frontop/Coding/smcp/smcp-cms'
    '113 smcp-public /Users/frontop/Coding/smcp/smcp-public'
    '201 smcp-platform-front /Users/frontop/Coding/smcp-front/smcp-platform-front'
    '202 smcp-tenant-front /Users/frontop/Coding/smcp-front/smcp-tenant-front'
    '203 miniprogram-guide /Users/frontop/Coding/smcp-front/miniprogram-guide'
    '301 iBeaconSet /Users/frontop/Coding/smcp-app/iBeaconSet'
    '401 nhcms /Users/frontop/Coding/nh/nhcms'
    '402 nhweb /Users/frontop/Coding/nh/nhweb'
    '501 hengjian-websocket /Users/frontop/Coding/hengjian/hengjian-websocket'
    '502 hengjian-front-send /Users/frontop/Coding/hengjian/hengjian-front-send'
    '503 hengjian-front-receive /Users/frontop/Coding/hengjian/hengjian-front-receive'
)

for i in "${gitarr[@]}"; do

    git=($i)

    git_number=${git[0]}
    git_name=${git[1]}
    git_path=${git[2]}

    echo "${git_number} pull ${git_name}"
    cd ${git_path}
    git pull
    echo

done

# DATE=$(date +%Y%m%d%H%M)
# echo "压缩: smcp coding"
# cd /Users/frontop/Coding
# zip -r ${DATE}-smcp.zip smcp smcp-front smcp-app

# ./qshell fput bucket2021 ${DATE}-smcp.zip ${DATE}-smcp.zip
# rm -rf ${DATE}-smcp.zip

echo
echo "备份完成时间："
date "+%F %T"
echo
